<template name="xiaofeiCode">
	<view class="epMain">
		<text class="boxTitle">消费券</text>
		<view class="epBox">
			<view class="epCnt">
				<view class="epCpde">
					<text>券号</text>
					<text>{{code}}</text>
				</view>
				<text class="tishi">*为保障您的权益，请确认无误后再提供消费券码</text>
			</view>
			<text class="iconfont icon-two-dimensional-code" @tap="toPage" data-url="qrCode" :data-code="code" date-type="1"></text>
		</view>
	</view>
</template>

<script>
	import {mapState,mapGetters,mapMutation,mapActions} from "vuex";
	export default{	
		name:'xiaofeiCode',		//组件名称
		// 传递参数
		props:{
			orderInfo:{
				type:Object,
				default:null
			},
			orderData:{
				type:Object,
				default:null
			}
		},
		// 组件参数
		data(){
			return {
				code:''
			}
		},
		// 组件方法
		methods:{
			getData(){
				// this.$store.dispatch("apiGetEpCode",this.orderInfo.order_id)
				// .then(res=>{
				// 	this.code=res.data.data
				// })
				if(this.orderData.tryTime){
					
					this.code = this.orderData.code
					
				}else{
					
					this.$store.dispatch("apiGetEpCode",this.orderInfo.order_id)
					.then(res=>{
						this.code=res.data.data
						
					})
					
				}
			}
		},
		created() {
			this.getData()
		}
		
	}
</script>

<style lang="less" scoped>
	// @import "../../common/public.less";
	.epMain{
		display: flex;
		flex-direction: column;
		padding: 36upx;
		.epBox{
			display: flex;
			align-items: center;
			.epCnt{
				flex-grow: 1;
				display: flex;
				flex-direction: column;
				.epCpde{
					display: flex;
					
					font-size: 32upx;
					color: #202932;
					margin-bottom:20upx ;
					text:first-child{
						margin-right: 40upx;
					}
				}
				.tishi{
					font-size: 24upx;
					color: #939393;
				}
			}
			.iconfont{
				font-size: 80upx;
				margin-left: 40upx;
			}
		}
	}
	.boxTitle{
		color: #202932;
		margin-bottom: 36upx;
		font-size: 38upx;
		padding: 0;
	}
</style>
